-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stream select macro #2262
Stream select macro #2262
Conversation
c360f16
to
d3d9c53
Compare
b3b3271
to
4ddcdf1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR and sorry for the late review!
I think it makes sense to add a feature like this (this is actually a stream version of simple select), but I don't want to add features that rely on Fused{Future,Stream}
because Fused{Future,Stream}
will be removed in the next major version.
@taiki-e I've removed the FusedStream dependency, this is now ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impl LGTM. Sorry for the late review!
@taiki-e ready for re-review, thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @Xaeroxe!
Published in 0.3.17 |
Adds a new procedural macro to the futures crate that I've found some use for.
stream_select!
works similarly to theselect_all
function, but doesn't require the streams to all be the same type. Nor does it use aBox<dyn Stream>
to accomplish that.It's implemented in terms of the, but represents a type rather than multiple branches of execution. In my use case I would feed the stream fromselect!
macrostream_select!
into aselect!
statement, as many of the streams I want toselect!
over should be treated identically in theselect!
statement.Reviewers may ask "Why not just use the
select
function repeatedly?" And the answer to that is that recursive use of theselect
function results in an unfair stream, with priority being given to streams on the upper layers.